package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.VolunteerService;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface VolunteerServiceRepository extends JpaRepository<VolunteerService, Long>, JpaSpecificationExecutor<VolunteerService> {
	List<VolunteerService> findByUserId(@Param("userId") Long userId);
	List<VolunteerService> findByStatus(@Param("status") String status);
	@Query("select v from VolunteerService v where (:start is null or v.serviceDate >= :start) and (:end is null or v.serviceDate <= :end) order by v.serviceDate desc, v.createdAt desc")
	List<VolunteerService> findByDateRange(@Param("start") Date start, @Param("end") Date end);
} 